﻿<phone:PhoneApplicationPage 
    x:Class="Angerona.VehicleDetail"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>


    <phone:PhoneApplicationPage.Resources>
        
        <!-- DataTemplate per fuel -->
        
        <DataTemplate x:Name="FuelTemplateName" x:Key="FuelTemplate">
            <Grid Margin="0,0,0,15">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width=".8*"/>
                    <ColumnDefinition Width=".2*"/>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column="0" Orientation="Horizontal" Tap="tapOnElementFuelList">
                    <Image x:Name="fuelIconTemplate" Source="/Img/AppIcons/Fuel-01-01.png" Margin="5" Height="62" Width="62"/>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="{Binding OperationDate, StringFormat='d'}" FontSize="24"/>
                        <StackPanel Orientation="Horizontal" >
                            <TextBlock Text="{Binding Path=LocalizedResources.fuelspent, Source={StaticResource LocalizedStrings}}" FontSize="24" Margin="0" />
                            <TextBlock Text="{Binding Spent}" FontSize="24" Margin="5,0" />
                            <TextBlock Text="{Binding Path=LocalizedResources.quantity, Source={StaticResource LocalizedStrings}}" FontSize="24"/>
                            <TextBlock Text="{Binding Quantity}" FontSize="24" Margin="5,0" />
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
                <Image Grid.Column="1" Source="/Img/AppIcons/deleteIconGrey.png" Tap="Delete_Tap_Fuel" MaxHeight="62" MaxWidth="62" VerticalAlignment="Center" HorizontalAlignment="Right"/>
            </Grid>

        </DataTemplate>

        <!-- DataTemplate per Maintenance -->

        <DataTemplate x:Key="MaintenanceTemplate">
            <Grid Margin="0,0,0,15">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width=".8*"/>
                    <ColumnDefinition Width=".2*"/>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column="0" Orientation="Horizontal" Tap="tapOnElementMaintenanceList">
                    <Image Source="/Img/AppIcons/Mantinance-01-01.png" Height="62" Width="62" Margin="5"/>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="{Binding OperationDate, StringFormat='d'}" FontSize="24"/>
                        <StackPanel Orientation="Horizontal" >
                            <TextBlock Text="{Binding Path=LocalizedResources.fuelspent, Source={StaticResource LocalizedStrings}}" FontSize="24"/>
                            <TextBlock Text="{Binding Spent}" FontSize="24" Margin="5,0" />
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
                <Image Grid.Column="1" Source="/Img/AppIcons/deleteIconGrey.png" Tap="Delete_Tap_Maintenance" MaxHeight="62" MaxWidth="62" VerticalAlignment="Center" HorizontalAlignment="Right"/>
            </Grid>
        </DataTemplate>

        <!-- DataTemplate per Generic -->

        <DataTemplate x:Key="GenericTemplate">
            <Grid Margin="0,0,0,15">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width=".8*"/>
                    <ColumnDefinition Width=".2*"/>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column="0" Orientation="Horizontal" Tap="tapOnElementGenericList">
                    <Image Source="/Img/AppIcons/Generic-01.png" Height="55" Width="55" Margin="5"/>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="{Binding OperationDate, StringFormat='d'}" FontSize="24"/>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Path=LocalizedResources.fuelspent, Source={StaticResource LocalizedStrings}}" FontSize="24"/>
                            <TextBlock Text="{Binding Spent}" FontSize="24" Margin="5,0" />
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
                <Image Grid.Column="1" Source="/Img/AppIcons/deleteIconGrey.png" Tap="Delete_Tap_Generic" MaxHeight="62" MaxWidth="62" VerticalAlignment="Center" HorizontalAlignment="Right"/>
            </Grid>
        </DataTemplate>

    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <!--Pivot Control-->
        <controls:Pivot x:Name="Vpivot" SelectionChanged="Vpivot_selChanged" Title="ANGERONA">
            <!--Pivot item 1-->
            <controls:PivotItem Header="{Binding Path=LocalizedResources.vehicle_details_pivot1, Source={StaticResource LocalizedStrings}}">
                <ScrollViewer>

                    <StackPanel Orientation="Vertical" Visibility="Visible" FlowDirection="LeftToRight">
                        
                        <!--COMMENTO PER RISALTO DEL NOME ALL'INTERNO DELLA PAGINA DETTAGLIO-->
                        <!--<TextBlock x:Name="Label_carname" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carname, Source={StaticResource LocalizedStrings}}" FontSize="36" />-->
                        <Image x:Name="imageOfTheCar" Width="400" Height="200" Visibility="Collapsed"/>
                        <TextBlock Margin="0,0,0,20" x:Name="carname" HorizontalAlignment="Left" FontSize="46" FlowDirection="LeftToRight" Foreground="{StaticResource PhoneAccentBrush}"/>


                        <TextBlock x:Name="Label_carmanufacter" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carmanufacter, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="carmanufacter" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_carmodel" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carmodel, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="carmodel" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>
                        
                        <TextBlock x:Name="Label_carfuel" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carfuel, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="carfuel" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_carhorse" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carhorse, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="carhorse" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>
                        
                        <TextBlock x:Name="Label_carkw" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carkw, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="carkw" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_carvolume" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carvolume, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="carvolume" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_carplate" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carplate, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="carplate" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_carserial" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carserial, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="carserial" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_carboughtdate" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carboughtdate, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="carboughtdate" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_carproductiondate" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carproductiondate, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="carproductiondate" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_carinitialkm" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.carinitialkm, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="carinitialkm" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_cartraveledkm" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.cartraveledkm, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="cartraveledkm" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_assurancecompany" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.assurancecompany, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="assurancecompany" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_assurancenumber" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.assurancecompany, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="assurancenumber" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_assurancedate" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.assurancedate, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="assurancedate" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_bollodate" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.bollodate, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="bollodate" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                        <TextBlock x:Name="Label_revisiondate" Width="auto" Height="auto" HorizontalAlignment="Left" Text="{Binding Path=LocalizedResources.revisiondate, Source={StaticResource LocalizedStrings}}" FontSize="36" />
                        <TextBlock x:Name="revisiondate" HorizontalAlignment="Right" FontSize="32" FlowDirection="RightToLeft"/>

                </StackPanel>
                </ScrollViewer>

            </controls:PivotItem>

            <!--Pivot item 2-->
            <controls:PivotItem Header="{Binding Path=LocalizedResources.vehicle_details_pivot2, Source={StaticResource LocalizedStrings}}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height=".5*"/>
                        <RowDefinition Height=".5*"/>
                    </Grid.RowDefinitions>
                    <Grid Grid.Row="0">
                        <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Grid.Row="0" Text="{Binding Path=LocalizedResources.labelQuantityLocalization, Source={StaticResource LocalizedStrings}}" FontSize="40" HorizontalAlignment="Center"/>
                        <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=LocalizedResources.labelCurrencyLocalization, Source={StaticResource LocalizedStrings}}" FontSize="40" HorizontalAlignment="Center"/>
                            <TextBlock Grid.Column="0" Grid.Row="1" FontSize="64" x:Name="allQuantityMade"  HorizontalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}"/>
                            <TextBlock Grid.Column="1" Grid.Row="1" FontSize="64" x:Name="allFuelOperationsCost" HorizontalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}"/>

                            <TextBlock Grid.Column="0" Grid.Row="2" FontSize="40" Text="Range" Foreground="{StaticResource PhoneAccentBrush}" />
                            <toolkit:DatePicker x:Name="dp_fuel_from_date" Grid.Column="0" Grid.Row="3" ValueChanged="dp_fuel_date_ValueChanged"  />
                            <toolkit:DatePicker x:Name="dp_fuel_to_date" Grid.Column="1" Grid.Row="3" ValueChanged="dp_fuel_date_ValueChanged"/>
                        </Grid>
                            <toolkit:LongListSelector Grid.Row="1" x:Name="FuelList" ItemTemplate="{StaticResource FuelTemplate}" IsFlatList="True" IsBouncy="False">
                                <toolkit:LongListSelector.ListHeaderTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=LocalizedResources.fueloperations, Source={StaticResource LocalizedStrings}}" FontSize="32" Foreground="{StaticResource PhoneAccentBrush}"/>
                                    </DataTemplate>
                                </toolkit:LongListSelector.ListHeaderTemplate>
                            </toolkit:LongListSelector>
                    </Grid>
            </controls:PivotItem>
            
            <!--Pivot item 3-->
            <controls:PivotItem Header="{Binding Path=LocalizedResources.vehicle_details_pivot3, Source={StaticResource LocalizedStrings}}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height=".5*"/>
                        <RowDefinition Height=".5*"/>
                    </Grid.RowDefinitions>
                    <Grid Grid.Row="0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding Path=LocalizedResources.labelCurrencyLocalization, Source={StaticResource LocalizedStrings}}" FontSize="40" HorizontalAlignment="Center"/>
                        <TextBlock Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" FontSize="64" x:Name="allMaintenanceSpentLabel"  HorizontalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}"/>


                        <TextBlock Grid.Column="0" Grid.Row="2" FontSize="40" Text="Range" Foreground="{StaticResource PhoneAccentBrush}" />
                        <toolkit:DatePicker x:Name="dp_man_from_date" Grid.Column="0" Grid.Row="3" ValueChanged="dp_man_date_ValueChanged" />
                        <toolkit:DatePicker x:Name="dp_man_to_date" Grid.Column="1" Grid.Row="3" ValueChanged="dp_man_date_ValueChanged"/>
                    </Grid>
                    <toolkit:LongListSelector Grid.Row="1" x:Name="MaintenanceList" ItemTemplate="{StaticResource MaintenanceTemplate}" IsFlatList="True">

                        <toolkit:LongListSelector.ListHeaderTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Path=LocalizedResources.maintenanceoperations, Source={StaticResource LocalizedStrings}}" FontSize="32" Foreground="{StaticResource PhoneAccentBrush}"/>
                            </DataTemplate>
                        </toolkit:LongListSelector.ListHeaderTemplate>
                    </toolkit:LongListSelector>
                </Grid>
            </controls:PivotItem>
            
            <!--Pivot item 4-->
            <controls:PivotItem Header="{Binding Path=LocalizedResources.vehicle_details_pivot4, Source={StaticResource LocalizedStrings}}">
                <ScrollViewer>
                    <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height=".5*"/>
                        <RowDefinition Height=".5*"/>
                    </Grid.RowDefinitions>
                    <Grid Grid.Row="0">
                        <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding Path=LocalizedResources.labelCurrencyLocalization, Source={StaticResource LocalizedStrings}}" FontSize="40" HorizontalAlignment="Center"/>
                            <TextBlock Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" FontSize="64" x:Name="allGenericSpentLabel"  HorizontalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}"/>

                            <TextBlock Grid.Column="0" Grid.Row="2" FontSize="40" Text="Range" Foreground="{StaticResource PhoneAccentBrush}" />
                            <toolkit:DatePicker x:Name="dp_gen_from_date" Grid.Column="0" Grid.Row="3" ValueChanged="dp_gen_date_ValueChanged" />
                            <toolkit:DatePicker x:Name="dp_gen_to_date" Grid.Column="1" Grid.Row="3" ValueChanged="dp_gen_date_ValueChanged"/>
                        </Grid>
                    <toolkit:LongListSelector Grid.Row="1" x:Name="GenericList" ItemTemplate="{StaticResource GenericTemplate}" IsFlatList="True">
                        <toolkit:LongListSelector.ListHeaderTemplate>
                            <DataTemplate>
                                    <TextBlock Text="{Binding Path=LocalizedResources.genericoperations, Source={StaticResource LocalizedStrings}}" FontSize="32" Foreground="{StaticResource PhoneAccentBrush}"/>
                            </DataTemplate>
                        </toolkit:LongListSelector.ListHeaderTemplate>
                    </toolkit:LongListSelector>
                </Grid>
                </ScrollViewer>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>
    
</phone:PhoneApplicationPage>